import pandas as pd
import numpy as np
import re
df=pd.read_excel('附件4.xlsx')
a=len(df.index)
x=[]
y=[]
z=[]
for i in range(0,a):
    b=df.原料与占比[i]
    c=tuple(b.split(","))
    for j in c:
        d=re.findall(r"(.+?)\(", j)
        e=re.findall(r"占(.+?)\)", j)
        x.append(i+1)
        y.append(d)
        z.append(e)
m={'序号':x,'原料名称':y,'百分比':z}
m=pd.DataFrame(m)
m.to_excel('result4_2.xlsx',index=False)




